package com.xjoyt.pay.operater.controllers;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xjoyt.pay.controllers.AbstractController;
import com.xjoyt.pay.dto.ExecuteResult;
import com.xjoyt.pay.dto.PageParam;
import com.xjoyt.pay.dto.PageResult;
import com.xjoyt.pay.operater.auth.interfaces.RoleContract;
import com.xjoyt.pay.operater.auth.params.RolePageParam;
import com.xjoyt.pay.operater.auth.po.Role;
import com.xjoyt.pay.operater.services.RoleService;

@RestController
@RequestMapping("role")
public class RoleController extends AbstractController implements RoleContract {

	@Autowired
	private RoleService service;

	@Override
	public PageResult<Role> loadPage(@RequestBody PageParam<RolePageParam> param) {
		return service.loadPage(param);
	}

	@Override
	public List<Role> findAll(@RequestBody RolePageParam param) {
		return service.findAll(param);
	}

	@Override
	public ExecuteResult<Role> save(@RequestBody Role param) {
		return service.save(param);
	}

	@Override
	public ExecuteResult<?> remove(@PathVariable("id") String id) {
		return service.delete(id);
	}

	@Override
	public ExecuteResult<?> saveNode(@PathVariable("id") String id, @RequestBody List<String> nodeList) {
		return service.saveNode(id, nodeList);
	}

}
